package com.example.film.mapper;

import com.example.film.entity.PublishInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PublishInfoMapper {
    //发行信息table-->publishinfo
    //查找发行信息
    @Select("select releaseDate,filmName,country,producer from publishinfo")
    List<PublishInfo> findPublishInfo();

    //分页查询发行信息
    @Select("select releaseDate,filmName,country,producer from publishinfo LIMIT #{pageSize} OFFSET #{startIndex}")
    List<PublishInfo> findPublishMessage(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize);

    //根据年份和月份查找发行信息
    @Select("select releaseDate,filmName,country,producer from publishinfo where year(releaseDate)=#{year} and month(releaseDate)=#{month}")
    List<PublishInfo> findPublishInfoByDate(@Param("year") Integer year,@Param("month") Integer month);
}
